import req from '@/utils/request';
import * as URL from '@/constants/api';

// 搜索建议
export function getSuggestList (v) {
  return req({
    url: URL.SEARCH_SUGGEST_LIST,
    params: { 
      q: v,
    },
  })
  .then(res => res.data.data.options.filter(item => !!item))
  .catch(() => []);
}

// 搜索结果
export function getResultList (v) {
  return req({
    url: URL.SEARCH_RESULT,
    params: { 
      q: v,
    },
  })
  .then(res => res.data.data.results);
}
